<template>
	<div>
		<el-row :gutter="24">
			<el-col :span="2">
				<p class="labelText">起始日期:</p>
			</el-col>
			<el-col :span="4">
				<el-date-picker v-model="queryData.startDate" size="small" type="date" :clearable="true" style="width:90%;" placeholder="数据共享开始日期">
				</el-date-picker>
			</el-col>
			<el-col :span="2">
				<p class="labelText">截止日期:</p>
			</el-col>
			<el-col :span="4">
				<el-date-picker v-model="queryData.stopDate" size="small"  :clearable="true" style="width:90%;" type="date" placeholder="数据共享结束日期">
				</el-date-picker>
			</el-col>
			
			<el-col :span="12" style="padding-left: 0px;text-align: left">
				<el-button type="primary" size="small" v-on:click="query">查询</el-button> 
			</el-col>
		</el-row>
		
		
		<el-row>
				<el-col>
					<el-table :data="tableData.dataList" @row-dblclick="dbClick" stripe border>
						<el-table-column prop="plateNum" label="车牌号" width="180">
						</el-table-column>
	          			<el-table-column prop="vin" label="VIN" width="180">
						</el-table-column>
						<el-table-column prop="ownerName" label="车主" width="180">
						</el-table-column>
	          			<el-table-column prop="ownerTel" label="车主电话" width="180">
						</el-table-column>
						<el-table-column prop="series" label="车系" width="180">
						</el-table-column>
						<el-table-column prop="ownerAddress" label="车主住址" width="250">
						</el-table-column>
						<el-table-column prop="companyName" label="归属公司" width="250">
						</el-table-column>
						
					</el-table>
					<el-pagination small @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="CurentPage" :page-sizes="page.pageSizes" :page-size="page.pageSize" layout="total,prev, pager, next" :total="tableData.total">
					</el-pagination>
				</el-col>
			</el-row>
	</div>
</template>

<script>
	export default {
		data:function(){
			return{
				tableData:{
			      	dataList:[],
			      	total:0
			      },
			    queryData:{
			    	startDate:'',
			    	stopDate:'',
				},
			}
		},
		methods:{
			
			//列表，分页大小切换
		    handleSizeChange: function() {},
		    //列表,当前页切换
		    handleCurrentChange: function(currentPage) {
		      this.$data.CurentPage = currentPage;
		    },
		    //查询
		    query:function(){
		    	
		    	if(this.$data.queryData.startDate) {
					this.$data.queryData.startDate = this.moment(this.$data.queryData.startDate).format("YYYY-MM-DD");
				}
				if(this.$data.queryData.stopDate) {
					this.$data.queryData.stopDate = this.moment(this.$data.queryData.stopDate).format("YYYY-MM-DD");
				}
		    	
		    	this.$http({
		        method: "POST",
		        url: this.API_ROOT + "/crm/link/car/page",
		        body: this.$data.queryData
		      }).then(
		        function(resp) {
		          if(resp.data.success){
		          	this.$data.tableData = resp.data;
		          	this.$data.tableData.total = Number(resp.data.total);
		          	this.$message(resp.data.msg);
		          }
		          else{
		          	this.$message.error(resp.data.msg);
		          }
		        },
		        function(error) {
		          // error
		        }
		      );
		      
		      
		      
		    }
		    
		},
		created:function(){
			
		}
	}
</script>

<style>
</style>